//定义共有变量：
let locationUrl = "http://58.49.34.220:8801/NCCB/CCBStreamTXRoute";
let codeUrl = "http://58.49.34.220:8801/NCCB/CCBCommonTXRoute";
let code = '';
let mobileNumber = '';//手机号码
let randomNum = parseInt(Math.random() * Math.pow(10, 19)).toString();//客户编号需要的随机数
// Cst_ID = randomNum + mobileNumber;//客户编号
let userInfo;

const key = '';
const iv = '';
const aes_key = '';

// 格式化时间
const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return [year, month, day].map(formatNumber).join('') + [hour, minute, second].map(formatNumber).join('')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}

//CBC模式加密
const setSecure = message => {
  return message;
}

const getSecure = word => {
  return word;
}

module.exports = {
  formatTime,
  locationUrl,
  codeUrl,
  code,
  randomNum,
  userInfo,
  key,
  iv,
  aes_key,
  setSecure,
  getSecure
}
